package com.lancoo.znbkxx.teacher.ui.fragment.cognitiveAssessment

import android.graphics.Typeface
import android.view.View
import com.lancoo.znbkxx.teacher.R
import com.lancoo.znbkxx.teacher.aibkTestCoach.kBase.KBaseFragment
import kotlinx.android.synthetic.main.fragment_cognitive_assessment_top_view.view.*

/*
* 认知平均分
* */
class CaCognitiveAverageScoreFragment: KBaseFragment() {

    private var rootView: View? = null

    override fun createLayout(): Int {
        return R.layout.fragment_cognitive_assessment_top_view
    }

    override fun initView(view: View?) {
        rootView = view

        rootView!!.IvViewIcon.setImageResource(R.mipmap.aibk_icon_ca_cognitive_average_score)
        rootView!!.TvViewTitle.text = requireActivity().resources.getString(R.string.tv_title_2)
        rootView!!.LlScoreView.setBackgroundResource(R.mipmap.aibk_icon_ca_circle_progress_orange)
        rootView!!.IvScoreRank.visibility = View.VISIBLE
        rootView!!.IvScoreRank.setImageResource(R.mipmap.aibk_icon_ca_level_a)
        rootView!!.TvScoreValue.text = 3452.toString()
        rootView!!.TvScoreValue.typeface = Typeface.createFromAsset(requireActivity().assets, "fonts/DIN Condensed Bold.ttf")
        rootView!!.TvScoreUnit.text = requireActivity().resources.getString(R.string.tv_unit_1)
        rootView!!.TvScoreFull.visibility = View.VISIBLE
        rootView!!.TvScoreFull.text = requireActivity().resources.getString(R.string.tv_full_score,10000.toString())

        rootView!!.TvChangeClass1.text = requireActivity().resources.getString(R.string.tv_change_title_6)
        rootView!!.TvChangeClass2.text = requireActivity().resources.getString(R.string.tv_change_title_7)
        rootView!!.TvChangeClass3.text = requireActivity().resources.getString(R.string.tv_change_title_8)
        rootView!!.TvChangeClass4.text = requireActivity().resources.getString(R.string.tv_change_title_9)
        rootView!!.TvChangeClass5.text = requireActivity().resources.getString(R.string.tv_change_title_10)

        val drawableUp = resources.getDrawable(R.mipmap.aibk_icon_ca_grades_up)
        drawableUp.setBounds(0, 0, drawableUp.minimumWidth, drawableUp.minimumHeight)
        val drawableDown = resources.getDrawable(R.mipmap.aibk_icon_ca_grades_down)
        drawableDown.setBounds(0, 0, drawableDown.minimumWidth, drawableDown.minimumHeight)

        rootView!!.TvChangeClassValue1.setCompoundDrawables(drawableDown,null,null,null)
        rootView!!.TvChangeClassValue1.text = 12.toString()
        rootView!!.TvChangeClassValue1.setTextColor(requireActivity().resources.getColor(R.color.lancoooRed))
        rootView!!.TvChangeClassValue2.setCompoundDrawables(null,null,null,null)
        rootView!!.TvChangeClassValue2.text = 22.toString()
        rootView!!.TvChangeClassValue2.setTextColor(requireActivity().resources.getColor(R.color.lancoooGreen))
        rootView!!.TvChangeClassValue3.setCompoundDrawables(null,null,null,null)
        rootView!!.TvChangeClassValue3.text = 32.toString()
        rootView!!.TvChangeClassValue3.setTextColor(requireActivity().resources.getColor(R.color.lancoooGreen))
        rootView!!.TvChangeClassValue4.setCompoundDrawables(null,null,null,null)
        rootView!!.TvChangeClassValue4.text = 442.toString()
        rootView!!.TvChangeClassValue4.setTextColor(requireActivity().resources.getColor(R.color.lancoooBlue))
        rootView!!.TvChangeClassValue5.setCompoundDrawables(null,null,null,null)
        rootView!!.TvChangeClassValue5.text = 52.toString()
        rootView!!.TvChangeClassValue5.setTextColor(requireActivity().resources.getColor(R.color.lancoooBlue))
    }
}